# Contributor: Kaarle Ritvanen <kunkku@alpinelinux.org>
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py3-factory-boy
_pkgname=factory_boy
pkgver=2.12.0
pkgrel=4
pkgdesc="A verstile test fixtures replacement based on thoughtbot's factory_girl for Ruby"
url=https://github.com/rbarrois/factory_boy
arch="noarch"
license=MIT
depends="python3 py3-faker py3-six"
makedepends="py3-setuptools"
checkdepends="
	py3-mock py3-django py3-sqlalchemy
"
source="$pkgname-$pkgver.tar.gz::https://github.com/FactoryBoy/$_pkgname/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-factory-boy" # Backwards compatibility
provides="py-factory-boy=$pkgver-r$pkgrel" # Backwards compatibility

prepare() {
	default_prepare
	# mongodb is not supported by Alpine Linux
	rm factory/mongoengine.py
	sed -i factory/__init__.py -e 's/from . import mongoengine//g'
	rm tests/test_mongoengine.py
	sed -i tests/__init__.py -e 's/from .test_mongoengine.*//g'
}

build() {
	python3 setup.py build
}

check() {
	python3 setup.py test
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="33236bc02d5331998bb210af498bea46fc9540e66af32db8fdab563193b7ae8870e7cc01c93c24a03ee23ba64bac6ca27a72bb51a264d1c7b6bf9b098c65d5d2  py3-factory-boy-2.12.0.tar.gz"
